package Homework;

import java.util.HashMap;
import java.util.Set;
import java.util.Map.Entry;

public class work08 {

	public static void main(String[] args) {
		String x="ppRYYGrrYBR2258";
		String y="YrR8RrY";
		p(x,y);
	}

	private static void p(String max, String min) {
		HashMap<Character,Integer> hashMax = toMap(max);
		HashMap<Character,Integer> hashMin = toMap(min);
		Set<Entry<Character, Integer>> entrySet = hashMin.entrySet();
		for(Entry<Character, Integer> e : entrySet){
			char k = e.getKey();
			int times = e.getValue();
			if(!hashMax.containsKey(k) || hashMax.get(k)<times){
				System.out.println("NO");
				return;
			}
		}
		System.out.printf("YES %d",max.length()-min.length());
	}
	
	public static HashMap toMap(String str){
		char[] ch = str.toCharArray();
		HashMap<Character,Integer> hashMap = new HashMap();
		for(char c : ch){
			if(hashMap.containsKey(c)){
				int value = hashMap.get(c);
				hashMap.put(c, value+1);
			}else{
				hashMap.put(c, 1);
			}
		}
		return hashMap;
	}

}
